package dk.pun.dums.client.event;

import com.google.gwt.event.shared.GwtEvent;

import dk.pun.dums.shared.character.CharacterData;

public class CharacterRenamedEvent extends GwtEvent<SelectCharacterEventHandler> {

	public static final Type<SelectCharacterEventHandler> TYPE = new Type<SelectCharacterEventHandler>();

	private final transient CharacterData characterData;
	private final transient String oldName;
	
	public CharacterRenamedEvent(final CharacterData characterData, final String oldName) {
		super();
		this.characterData = characterData;
		this.oldName = oldName;
	}

	public CharacterData getCharacterData() {
		return characterData;
	}

	public String getOldName() {
		return oldName;
	}

	@Override
	public Type<SelectCharacterEventHandler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(final SelectCharacterEventHandler handler) {
		handler.onCharacterRenamed(this);
	}

}
